3 # define some callbacks
7 def checkcallback(value
):
8 print "hit the checkbox", value
10 def radiocallback(value
):
11 print "hit radiobutton #3", value
13 def scrollcallback(value
):
16 widget
.set(widget
.get() - 1)
18 widget
.set(widget
.get() + 1)
20 widget
.set(widget
.get() - 10)
22 widget
.set(widget
.get() + 10)
25 print "scroll...", widget
.get()
28 window
.et3
.set(window
.et1
.get())
32 EasyDialogs
.Message("Cancel!")
34 # make a non-sizable window
35 #window = W.Window((200, 300), "Fixed Size")
37 # make a sizable window
38 window
= W
.Window((200, 300), "Variable Size!", minsize
= (200, 300))
40 # make some edit text widgets
41 window
.et1
= W
.EditText((10, 10, 110, 110), "Hallo!", textcallback
)
42 window
.et2
= W
.EditText((130, 40, 60, 30), "one!")
43 window
.et3
= W
.EditText((130, 80, -10, 40), "two?")
46 window
.button
= W
.Button((-70, 10, 60, 16), "Close", callback
)
49 window
.ch
= W
.CheckBox((10, 130, 160, 16), "Check (command \xa4)", checkcallback
)
51 # set of radio buttons (should become easier/nicer)
53 window
.r1
= W
.RadioButton((10, 150, 180, 16), "Radio 1 (cmd 1)", thebuttons
)
54 window
.r2
= W
.RadioButton((10, 170, 180, 16), "Radio 2 (cmd 2)", thebuttons
)
55 window
.r3
= W
.RadioButton((10, 190, 180, 16), "Radio 3 (cmd 3)", thebuttons
, radiocallback
)
59 window
.cancelbutton
= W
.Button((10, 220, 60, 16), "Cancel", cancel
)
62 window
.hbar
= W
.Scrollbar((-1, -15, -14, 16), scrollcallback
, max = 100)
65 window
.static
= W
.TextBox((10, 260, 110, 16), "Schtatic")
67 # bind some keystrokes to functions
68 window
.bind('cmd\xa4', window
.ch
.push
)
69 window
.bind('cmd1', window
.r1
.push
)
70 window
.bind('cmd2', window
.r2
.push
)
71 window
.bind('cmd3', window
.r3
.push
)
72 window
.bind('cmdw', window
.button
.push
)
73 window
.bind('cmd.', window
.cancelbutton
.push
)
75 window
.setdefaultbutton(window
.button
)